package com.example.shopping;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import android.os.Bundle;
import android.view.View;

import com.example.shopping.goods.GoodsTypeFragment;

public class GoodsTypeActivity extends AppCompatActivity {
    private  int cid;//当前的id
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_goods_type);
       cid=getIntent().getIntExtra("cid",1);
       initFrag();
    }

    private void initFrag() {
        GoodsTypeFragment gtFrag=new GoodsTypeFragment();
        Bundle bundle=new Bundle();
        bundle.putInt("cid",cid);
        gtFrag.setArguments(bundle);
        FragmentManager fm=getSupportFragmentManager();
        FragmentTransaction tran=fm.beginTransaction();
        tran.replace(R.id.goodstype_layout,gtFrag);
        tran.commit();
    }

    public void onClick(View view) {
        finish();//关闭当前的activity
    }
}
